#include "button.h"

Button::Button() : Panel(false)
{
	isTransparant = false;
	v_width = 60;
	v_height = 40;
}

void Button::draw()
{
	if (active)
	{
		drawBackground();
		drawBorders();
		drawChildren();
	}
}

void Button::genEvent(const int& button, const std::string& name, const cmdsettings& cmds, EventProperty_Repeat repeat, unsigned int delay )
{
	eventname = name;
	buttonlist[button] = BeEventSystem::Instance()->registerEvent( name, boost::shared_ptr<Event>(new Event( cmds, repeat, delay) ) );
}

void Button::click(const int& button)
{
	BeEventSystem::Instance()->activateKeystate( buttonlist[button] );
}

void Button::release(const int& button)
{
	BeEventSystem::Instance()->deactivateKeystate( buttonlist[button] );
}

Button::~Button()
{
}
